/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 * Description: dpaa eth driver Vendor Hooks
 */

#ifdef CONFIG_NETBIOS_DPAA_ETH_SPEC

#ifndef DPAA_ETH_EXT_H
#define DPAA_ETH_EXT_H
#include <linux/netdevice.h>
#include <soc/fsl/bman.h>
#include <soc/fsl/qman.h>
#include "fman.h"
#include "fman_port.h"
#include "mac.h"
#include "dpaa_eth.h"
extern const struct of_device_id dpa_match[];
#define DPAA_DEVICE_TYPE NULL
#define DPAA_MATCH_TABLE dpa_match
#define NET_STATIC
netdev_tx_t dpaa_start_xmit(struct sk_buff *skb,
						struct net_device *net_dev);
bool trace_soc_has_errata_a010022(void);
int trace_net_dpaa_extend_tx_complete(struct net_device *net_dev,
						struct sk_buff *skb, void *param);
void trace_net_dpaa_extend_up(struct net_device *net_dev);
void trace_net_dpaa_extend_down(struct net_device *net_dev);
void trace_dpaa_ioctl_user(struct net_device *net_dev,
						struct ifreq *rq, int cmd, int *ret);
void trace_net_dpaa_flowctl_ext(struct dpaa_priv *priv, int *err);
bool trace_dpaa_fixed_link(struct mac_device *mac_dev);
int trace_net_dpaa_dqrr_flowctl_ext(struct net_device *net_dev,
						struct sk_buff *skb, unsigned int skb_len,
						struct rtnl_link_stats64 *percpu_stats);
void trace_dpaa_deal_sg_skb(enum qm_fd_format fd_format,
						const struct dpaa_priv *priv,
						struct sk_buff **skb_ptr);
void trace_dpaa_eth_mac_sysfs_remove(struct device *dev);
void trace_dpaa_mac_dev_get(struct platform_device *pdev,
						struct mac_device **macdev_ptr);
int trace_dpaa_register_nb_func(struct net_device *net_dev,
						struct device *dev, int *ret);
int trace_dpaa_init_flowctl_spec(struct net_device *net_dev,
						struct device *dev);
void trace_dpaa_uninit_flowctl_spec(struct net_device *net_dev);
int trace_dpaa_get_regs_len(struct net_device *net_dev);
void trace_dpaa_get_regs(struct net_device *net_dev,
						struct ethtool_regs *cmd, void *data);
int trace_dpaa_get_sset_count(unsigned int total_stats, int type);
void trace_dpaa_self_test(struct net_device *net_dev,
						struct ethtool_test *eth_test, u64 *data);
void trace_dpaa_mac_eth_get_strings(struct net_device *dev,
						u32 stringset, u8 **data);
void trace_dpaa_eth_get_ethtool_stats(struct net_device *netdev,
				struct ethtool_stats *stats, u64 *data, u32 *offset);
#endif

#else

struct net_device;
struct sk_buff;
struct ethtool_regs;
struct ethtool_test;
struct mac_device;
struct platform_device;
struct dpaa_priv;
struct ifreq;
struct rtnl_link_stats64;
enum qm_fd_format;
struct device;
#define DPAA_DEVICE_TYPE dpaa_devtype
#define DPAA_MATCH_TABLE NULL
#define NET_STATIC static
#define ETHTOOL_STATUS_NUM 0
#define SELF_TEST_TYPE_NUM 0
#define DECLARE_FUNC_NOP(name, proto, args)	\
	static inline void trace_##name(proto)		\
	{ }

static inline int trace_net_dpaa_extend_tx_complete(struct net_device *net_dev,
								struct sk_buff *skb, void *param)
{
	return 0;
}

DECLARE_FUNC_NOP(net_dpaa_extend_up,
	TP_PROTO(struct net_device *net_dev),
	TP_ARGS(net_dev));

DECLARE_FUNC_NOP(net_dpaa_extend_down,
	TP_PROTO(struct net_device *net_dev),
	TP_ARGS(net_dev));

DECLARE_FUNC_NOP(dpaa_ioctl_user,
	TP_PROTO(struct net_device *net_dev, struct ifreq *rq, int cmd, int *ret),
	TP_ARGS(net_dev, rq, cmd, ret));

DECLARE_FUNC_NOP(net_dpaa_flowctl_ext,
	TP_PROTO(struct dpaa_priv *priv, int *err),
	TP_ARGS(priv, ret));

static inline bool trace_dpaa_fixed_link(struct mac_device *mac_dev)
{
	return false;
}

static inline int trace_net_dpaa_dqrr_flowctl_ext(struct net_device *net_dev, struct sk_buff *skb,
	unsigned int skb_len, struct rtnl_link_stats64 *percpu_stats)
{
	return 0;
}

DECLARE_FUNC_NOP(dpaa_deal_sg_skb,
	TP_PROTO(enum qm_fd_format fd_format, const struct dpaa_priv *priv,
	struct sk_buff **skb_ptr),
	TP_ARGS(fd_format, priv, skb_ptr));

DECLARE_FUNC_NOP(dpaa_eth_mac_sysfs_remove,
	TP_PROTO(struct device *dev),
	TP_ARGS(dev));

DECLARE_FUNC_NOP(dpaa_mac_dev_get,
	TP_PROTO(struct platform_device *pdev, struct mac_device **macdev_ptr),
	TP_ARGS(pdev, macdev_ptr));

static inline int trace_dpaa_register_nb_func(struct net_device *net_dev,
											struct device *dev, int *ret)
{
	return 0;
}

static inline int trace_dpaa_init_flowctl_spec(struct net_device *net_dev,
											struct device *dev)
{
	return 0;
}

DECLARE_FUNC_NOP(dpaa_uninit_flowctl_spec,
	TP_PROTO(struct net_device *net_dev),
	TP_ARGS(net_dev));

static inline int trace_dpaa_get_regs_len(struct net_device *net_dev)
{
	return 0;
}

static inline int trace_dpaa_get_sset_count(unsigned int total_stats, int type)
{
	return 0;
}

DECLARE_FUNC_NOP(dpaa_get_regs,
	TP_PROTO(struct net_device *net_dev, struct ethtool_regs *cmd, void *data),
	TP_ARGS(net_dev, cmd, data));

DECLARE_FUNC_NOP(dpaa_self_test,
	TP_PROTO(struct net_device *net_dev, struct ethtool_test *eth_test, u64 *data),
	TP_ARGS(net_dev, eth_test, data));

DECLARE_FUNC_NOP(dpaa_mac_eth_get_strings,
	TP_PROTO(struct net_device *dev, u32 stringset, u8 **data),
	TP_ARGS(dev, stringset, data));

DECLARE_FUNC_NOP(dpaa_eth_get_ethtool_stats,
	TP_PROTO(struct net_device *netdev, struct ethtool_stats *stats,
	u64 *data, u32 *offset),
	TP_ARGS(netdev, stats, data, offset));

#endif
